<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Mikrobis - Protal Mikro Bisnis Indonesia</title>
<script src="<?php echo base_url();?>media/js/jquery.js" type="text/javascript"></script>
<script src="<?php echo base_url();?>media/js/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
</head>
<body>
<?php 

echo form_open_multipart('manajemen_proyek_saya/add_proyek');

echo validation_errors('<div class="error">', '</div>');

echo form_label('Nama Proyek','nama_proyek'),form_input('nama_proyek','','enabled',80),br();

$js_kategori = 'id="kategori_proyek" onChange="get_sub_kategori();"';
echo form_label('Kategori Proyek','kategori_proyek'),form_dropdown('kategori_proyek',$kategori_proyek,'','id="kategori_proyek" onChange=""'),br();

//echo form_label('Sub Kategori Proyek','sub_kategori'),form_dropdown('sub_kategori',$sub_kategori,'','enabled class="dynamic"',80),br();

?>

<label class="description" for="sub_kategori">Sub Kategori Proyek</label>				    
<select name="sub_kategori" id="sub_kategori">
    <option value="0">-- Pilih Sub Kategori Pr2oyek --</option>
    <?php 
		if (isset($sub_kategori)){													
			foreach ($sub_kategori as $key=>$value){ ?>
            <option class="dynamic" value="<?php echo $key; ?>"
			<?php if( set_value('sub_kategori') == $key){ echo "selected=''";}?>>
            <?php echo $value?>
    </option>
    ';
							
	<?php }}
						
	?>
</select>

<?php 
echo br();
echo form_label('Jumlah Pekerja','jumlah_pekerja'),form_input('jumlah_pekerja','','enabled',80),br();

echo form_label('Gaji Pekerja','gaji_pekerja'),form_input('gaji_pekerja','','enabled',80),br();

echo form_label('Terdapat Due Date Pengerjaan','pilihan_due_date'),br();
?>
<input id="due_date1" name="due_date" class="element radio" type="radio" value="1" onchange="ganti_plihan(this)" checked <?php if(set_value('pilihan')!='' && set_value('pilihan')==1) echo 'checked';?> />
<label class="choice" for="due_date1">Ada</label>
	
<input id="due_date2" name="due_date" class="element radio" type="radio" value="2" onchange="ganti_plihan(this)" <?php if(set_value('pilihan')!='' && set_value('pilihan')==2) echo 'checked'; $set_disabled='';?> />
<label class="choice" for="due_date2">Tidak Ada</label>

<?php
echo br(),form_label('Batas Akhir Pengerjaan','batas_akhir'),form_input('tanggal_akhir','','id="date" enabled',80),br();

echo form_label('Petunjuk Pengerjaan','petunjuk_pengerjaan'),form_textarea('petunjuk_pengerjaan','','id="petunjuk" enabled rows="100" cols="100"',80),br();

echo form_label('Syarat/Bukti Pengerjaan','syarat_pengerjaan'),form_textarea('syarat_pengerjaan','','id="syarat" enabled rows="100" cols="100"',80),br();

echo form_label('Lampiran petunjuk','lampiran_petunjuk'),form_upload('lampiran_petunjuk'),br();

echo form_label('Pilihan peket promosi','paket_promosi'),br();

foreach($promosi->result() as $row){
	echo form_checkbox('paket_promosi', $row->id_paket_promosi),form_label($row->keterangan_paket_promosi.' (Rp. '.$row->harga_paket_promosi.')','paket_promosi[]'),br();
}

echo form_submit('submit', 'Simpan'),br();

echo form_close();
?>

<script type="text/javascript">
	$("#nipp").change(function(){
    	var nipp = $('#nipp').val();
		$.ajax({
			url: '<?php echo site_url('api/get_nama_karyawan');?>/'+nipp,
			success: function( data ) {
				$('#nama_pegawai').val(data);
			}
		});
	});
			
		function get_sub_kategori(){
			var prp = $("#kategori_proyek").val();
				$.ajax({
					url: "<?php echo base_url();?>index.php/manajemen_proyek_saya/get_sub_kategori/",
					global: false,
					type: "POST",
					async: false,
					dataType: "html",
					data: "kategori_proyek="+ prp, //the name of the $_POST variable and its value
					success: function (response) {
							var dynamic_options2 = $("*").index( $('.dynamic')[0] );
							if ( dynamic_options2 != (-1)) 
							$(".dynamic").remove();
							$("#sub_kategori").append(response);
							$(".third").attr({selected: ' selected'});
					}          
				});
			 return false;
			}
			
		function get_program(){
			var prp = $("#jenis_bantuan").val();
				$.ajax({
					url: "<?php echo base_url();?>index.php/pendataan_hibah/get_program/",
					global: false,
					type: "POST",
					async: false,
					dataType: "html",
					data: "jenis_bantuan="+ prp, //the name of the $_POST variable and its value
					success: function (response) {
							var dynamic_options2 = $("*").index( $('.dynamic')[0] );
							if ( dynamic_options2 != (-1)) 
							$(".dynamic").remove();
							$("#program").append(response);
							$(".third").attr({selected: ' selected'});
					}          
				});
			 return false;
			}	
</script>

</body>
</html>